<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="java.lang.*" %>
<%@ page language="java" import="com.limao.Tool.CacheClass" %>
<%@ page language="java" import="com.limao.servlet.WebFunction"%>
<%@ page import="org.apache.http.util.TextUtils" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<%!
    String imgPath;
    String thisServer="s2";
%>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + path + "/";
    imgPath = CacheClass.getImgUrl();
    //imgPath = basePath;
%>

<base href="<%=basePath%>" imgbase="<%=imgPath%>">

<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

<link rel="stylesheet" href="mb/css/reset.css"/>
<link rel="stylesheet" href="mb/css/all_New.css"/>
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" >
<script src="mb/js/jquery-3.1.1.min.js"></script>
<script src="mb/js/jquery.touchSlider.js"></script>
<script src="mb/js/self.js"></script>
<script src="mb/js/common.js"></script>
<script src="mb/js/jquery.md5.js"></script>
<script src="pc/js/layer/layer.js"></script>

<c:if test="${sessionScope['userid'] != null}">
    <script type="text/javascript">
        //已登陆
        islogin = true;
        userid =${sessionScope.userid};
        userobj =${sessionScope.userobj};
        username = userobj.username;

    </script>
</c:if>

<%!
    public String getImageBasePath(String imgurl) {
        if (TextUtils.isEmpty(imgurl))
            return imgPath;
        if (!imgurl.startsWith("http://") && !imgurl.startsWith("https://")) {
            imgurl = imgPath + imgurl;
        }
        return imgurl;
    }
%>

<div id="loadingmask" class="theme-popover-progress">
    <div class="w100 h100 of">
        <img src="mb/images/loading_white.gif" class="jz hauto db" style="margin-top: 66%;width: 50px"/>
    </div>
</div>

<script>
	console.log('thisServer='+'<%=thisServer%>');
    function showProgressDg() {
        $('#loadingmask').show();
    }

    function closeProgressDg() {
        $('#loadingmask').hide();
    }
</script>

<!-- toast start -->
<div class="delayDialog w100 pf">
    <section class="jz of">
        <div class="dialogContent jz of cf tc f15">

        </div>
    </section>
</div>
<!-- toast end -->

<!-- dialog start -->
<div id="tipdialog_bg" class="theme-popover-mask">

</div>
<div id="dialog" class="dialog pf w100 h100">
    <section class="jz of bcf">
        <div id="dialogTitle" class="dialogTittle f17 tc jz">
            提示
        </div>
        <div id="dialogContent" class="content jz lh18 f14 of">

        </div>
        <div class="button w100 of clearfix">
            <button id="tipDialogCancel" class="fl cf f17" style="width: 50%;background: #CDCDCD;">取消</button>
            <button id="tipDialogSure" class="fl cf f17" style="width: 50%">确定</button>
        </div>
    </section>
</div>
<!-- dialog end -->

<script>
    /**
     * 显示toast提示
     * @param msg 信息
     * @param time 时间（秒）
     */
    function showToastCustomertime(msg, time) {
        var dialog = $('.delayDialog');
        var content = $('.dialogContent');

        dialog.fadeIn();
        content.text(msg);

        setTimeout(function () { //关键的setTimeout
            dialog.fadeOut();
        }, time);//等待time秒执行
    }

    /**
     * 显示toast提示
     * @param msg
     */
    function showToast(msg) {
        showToastCustomertime(msg, 2000);
    }

    /**
     * 提示对话框
     * @param dialog
     * @param mask
     * @param func 点击确定执行的方法
     * @param flag 标识 0 显示两个按钮 1 显示确定按钮 2 显示取消
     * @constructor
     */
     var haha = function (){
      console.log('hahahaha');
     }

    
    function showTipDialog(e,title, content, func, flag) {
     
        var dgTitle = $('#dialogTitle');
        var dgContent = $('#dialogContent');
        
        dgTitle.text(title);
        dgContent.html(content);

        var btnCancel = $("#tipDialogCancel");
        var btnConfirm = $("#tipDialogSure");

       	btnCancel.bind("click", cancelDialog);
        btnConfirm.bind("click", func);
               
              
        console.log(func);
		
        if (flag == 1) {
            btnCancel.hide(0);
            btnConfirm.show(0);
            btnConfirm.css('width', '100%');
        } else if (flag == 2) {
            console.log(btnCancel);
            btnConfirm.hide(0);
            btnCancel.show(0);
            btnCancel.css('width', '100%');
        } else {
            console.log(btnCancel);
            btnConfirm.show(0);
            btnCancel.show(0);
            btnConfirm.css('width', '50%');
            btnCancel.css('width', '50%');
        }

        var dialog = $('#dialog');
        var mask = $('#tipdialog_bg');
        mask.fadeIn();
        dialog.slideDown();
    }
    
    
    /**
     * 关闭提示对话框
     * @constructor
     */
    var cancelDialog = function () {
        var dialog = $('#dialog');
        var mask = $('#tipdialog_bg');

        mask.fadeOut();
        dialog.slideUp();
        
        console.log('已经取消，接下来不做任何事情');
        return false;
    }
    
       

</script>
